<template>
  <div class="adminqianming">
    <admin_top></admin_top>
    <div style="padding: 0 20px;">
      <el-table :data="tableData" style="text-align: center;" align="center" border >
        <el-table-column label="签名内容">
          <template slot-scope="scope">
            <span>{{ scope.row.summary }}</span>
          </template>
        </el-table-column>
        <el-table-column label="提交时间">
          <template slot-scope="scope">
            <span>{{ scope.row.created_at }}</span>
          </template>
        </el-table-column>
        <el-table-column label="提交店铺名">
          <template slot-scope="scope">
            <span>{{ scope.row.name }}</span>
          </template>
        </el-table-column>

        <el-table-column label="审核时间">
          <template slot-scope="scope">
            <span>{{ scope.row.examine_at }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button v-if="scope.row.status==0" type="text" @click="shenhe(1,scope.row.id)">审核通过</el-button>
            <el-button v-if="scope.row.status==0" type="text" @click="shenhe(2,scope.row.id)">审核拒绝</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div style="text-align: center;margin-top: 10px;padding-bottom: 10px;">
        <el-pagination
          @current-change="pagechange"
          background
          layout="prev, pager, next"
          :page-size="all.page_size"
          :total="total">
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
  import admin_top from './top.vue';
  import axios from 'axios'
  export default {
    components: {
      admin_top
    },
    name: 'adminqianming',
    data() {
      return {
        all: {
          page_size: 20,
          page: 1,
        },
        tableData: "",
        total:0
      }
    },
    watch: {

    },
    computed: {

    },
    created() {
      this.getlist()
    },
    methods: {
  
    
      //获取全部
      getlist: function() {
        var that = this
        axios.get('/api/plan-market/admin/message/sign/list',{
          params:this.all
        })
          .then(response => {
            if (response.data.msg.code == 0) {
              console.log(response.data)
              this.tableData = response.data.data.data
              this.total = response.data.data.total
            } else {
              this.$message.error(response.data.msg.info);
            }
          })
      },
      //翻页
      pagechange(val){

        this.all.page = val
        this.getlist()
      },
      //审核
      shenhe(type,id){
        if(type==1){
          var text = '确定通过审核吗'
        }else if(type==2){
          var text = '确定拒绝审核吗'

        }
        this.$confirm(text, '再次确认', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          axios.post('/api/plan-market/admin/message/sign/examine',{
            id:id,
            status:type
          })
            .then(response => {
              if(response.data){
                this.$message({
                  type: 'success',
                  message: '操作成功!'
                });
                this.getlist()
              }
              
            })
          
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          });          
        });
      }

    },

  }
</script>

<style scoped>
  .adminqianming {
    background: #EAEAEA;
    min-height: 100vh;
    padding: 0px;
  }
</style>
